package com.sunrise.gateway.web.core;

import com.dap.param.StringInput;
import com.sunrise.gateway.commons.CommonUtils;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

/***
 * 第三方转发功能
 * @author wangmin
 */
@Service
public class ThirdPartyEngine extends EngineBase {
    public String execute(HttpServletRequest req) {
        String group = CommonUtils.getGroup(req);

        Map<String, String[]> paramMap = req.getParameterMap();
        if (paramMap.isEmpty()) {
            return null;
        }

        StringInput input = new StringInput(paramMap);
        input.getCtrlData().setInternalRequestSource("ThirdPartyCallback");

        fillSessionInfoIntoCtrlDataInterface.fill(input, group, req);

        return executeRequestStr(group, input, true);
    }

}
